package com.jfblog.common;

import com.jfblog.model.Message;
import com.jfinal.plugin.ehcache.IDataLoader;

public class JFBlogCache {

	public static enum CacheKey {
		tags, friendlys, articles, messages, archives, cates
	}

	public static IDataLoader getIDataLoaderByKey(final CacheKey cacheKey) {
		final IDataLoader iDataLoader = new IDataLoader() {

			public Object load() {
				switch (cacheKey) {
				case messages:
					return Message.dao.findMsg4Page(1, 10);
				}
				return null;
			}

		};
		return iDataLoader;
	}

}
